import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from "@/views/back/layout/layout";
Vue.use(VueRouter)

const routes = [
    {
      path: "/redirect",
      component: Layout,
      hidden: true,
      children: [
        {
          path: "/redirect/:path*",
          component: () => import("@/views/back/redirect/index")
        }
      ]
    },
    {
      path: "/login",
      component: () => import("@/views/back/login/index"),
      hidden: true
    },
    {
      path: "/404",
      component: () => import("@/views/back/errorPage/404"),
      hidden: true
    }
]
export const constantRouterMap = [
  {
    path: "/",
    component: Layout,
    redirect: '/appeal-list',
    meta: { icon: "icon-guanwangfangwen", title: "诉求管理" },
    children: [
      {
        name: 'appeal-list',
        path: '/appeal-list',
        meta: { icon: "icon-guanwangfangwen", title: "诉求管理" },
        component: () => import('@/views/back/appealList/index.vue')
      },
    ]
  },
  {
    path: "/user",
    component: Layout,
    redirect: '/user-list',
    meta: { icon: "icon-guanwangfangwen", title: "用户管理" },
    children: [
      {
        name: 'user-list',
        path: '/user-list',
        meta: { icon: "icon-guanwangfangwen", title: "用户管理" },
        component: () => import('@/views/back/userManager/userList.vue')
      },
    ]
  },
  {
    path: "/account",
    component: Layout,
    redirect: '/account-list',
    meta: { icon: "icon-guanwangfangwen", title: "账号管理" },
    children: [
      {
        name: 'account-list',
        path: '/account-list',
        meta: { icon: "icon-guanwangfangwen", title: "账号管理" },
        component: () => import('@/views/back/accountManager/accountList.vue')
      },
    ]
  }
]
const router = new VueRouter({
  scrollBehavior: () => ({ y: 0 }),
  routes: [
    ...constantRouterMap,
    ...routes
  ],
})
export const asyncRouterMap = []
export default router